<html>
<head><meta charset="utf-8"><title>type library discussion · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html">type library discussion</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215122690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215122690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215122690">(Oct 30 2020 at 17:02)</a>:</h4>
<p>Hey <span class="user-group-mention" data-user-group-id="692">@WG-traits</span> -- would folks want to use a bit of sync time in ~1 hour to talk about type library planning?</p>



<a name="215122730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215122730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215122730">(Oct 30 2020 at 17:03)</a>:</h4>
<p>I might be able to do later too, but not too much later. Depends a bit on how much snow comes down here :)</p>



<a name="215122736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215122736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215122736">(Oct 30 2020 at 17:03)</a>:</h4>
<p><span aria-label="snowstorm" class="emoji emoji-1f328" role="img" title="snowstorm">:snowstorm:</span></p>



<a name="215125094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215125094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215125094">(Oct 30 2020 at 17:21)</a>:</h4>
<p>Are we doing zoom?</p>



<a name="215125113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215125113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215125113">(Oct 30 2020 at 17:21)</a>:</h4>
<p>I think the snow has stopped here</p>



<a name="215126709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215126709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215126709">(Oct 30 2020 at 17:33)</a>:</h4>
<p>nm, I won't be there <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> will read it afterwards though</p>



<a name="215130251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215130251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215130251">(Oct 30 2020 at 18:03)</a>:</h4>
<p>Zoom sounds good, but chat only also works</p>



<a name="215130357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215130357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215130357">(Oct 30 2020 at 18:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> around?</p>



<a name="215130655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215130655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215130655">(Oct 30 2020 at 18:06)</a>:</h4>
<p>yep</p>



<a name="215130673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215130673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215130673">(Oct 30 2020 at 18:06)</a>:</h4>
<p>just wrapped up something</p>



<a name="215130717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215130717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215130717">(Oct 30 2020 at 18:07)</a>:</h4>
<p>let's do zoom I guess</p>



<a name="215130742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215130742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215130742">(Oct 30 2020 at 18:07)</a>:</h4>
<p>who wants to join?</p>



<a name="215130754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215130754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215130754">(Oct 30 2020 at 18:07)</a>:</h4>
<p>I'll privmsg you the link :)</p>



<a name="215130770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215130770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215130770">(Oct 30 2020 at 18:07)</a>:</h4>
<p>or I'll just make it in the calendar</p>



<a name="215131071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215131071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215131071">(Oct 30 2020 at 18:09)</a>:</h4>
<p><a href="https://hackmd.io/vSz1MfmBSDSx5NkowiIUfQ">https://hackmd.io/vSz1MfmBSDSx5NkowiIUfQ</a></p>



<a name="215132317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215132317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215132317">(Oct 30 2020 at 18:18)</a>:</h4>
<p>I would have liked to join (just to listen), but I can’t right now</p>



<a name="215132445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215132445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215132445">(Oct 30 2020 at 18:19)</a>:</h4>
<p>Out of curiosity, will there be some sort of written or video "record"?</p>



<a name="215132957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215132957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215132957">(Oct 30 2020 at 18:23)</a>:</h4>
<p>we're recording it so it will be available later</p>



<a name="215141546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215141546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215141546">(Oct 30 2020 at 19:40)</a>:</h4>
<p>I created mentoring instructions for the TypeFolder in <a href="https://github.com/rust-lang/chalk/issues/642">chalk#642</a></p>



<a name="215142883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215142883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215142883">(Oct 30 2020 at 19:52)</a>:</h4>
<p>Also <a href="https://github.com/rust-lang/chalk/issues/643">chalk#643</a> for removing <code>TargetInterner</code></p>



<a name="215142938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215142938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215142938">(Oct 30 2020 at 19:53)</a>:</h4>
<p>Thank you <span class="user-mention" data-user-id="125131">@detrumi</span>!</p>



<a name="215145118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215145118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215145118">(Oct 30 2020 at 20:12)</a>:</h4>
<blockquote>
<p>TypeVisitor traits are a little different<br>
       * adopt rustc's design with <code>ControlFlow::Break</code>/<code>ControlFlow::Continue</code></p>
</blockquote>
<p>Hm, what was this about?</p>



<a name="215145199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215145199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215145199">(Oct 30 2020 at 20:13)</a>:</h4>
<p>I don't see any use of <code>ControlFlow</code> around <code>TypeVisitor</code></p>



<a name="215145401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215145401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215145401">(Oct 30 2020 at 20:15)</a>:</h4>
<p>Ah, <a href="https://github.com/rust-lang/rust/issues/78182">#78182</a> is not merged yet, that's why</p>



<a name="215146351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215146351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215146351">(Oct 30 2020 at 20:25)</a>:</h4>
<p>(The MCP was accepted just today)</p>



<a name="215159695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215159695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215159695">(Oct 30 2020 at 22:51)</a>:</h4>
<blockquote>
<p>adopt rustc’s design with ControlFlow::Break/ControlFlow::Continue</p>
</blockquote>
<p>Currently taking a look</p>



<a name="215161738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215161738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215161738">(Oct 30 2020 at 23:22)</a>:</h4>
<p>Oh, actually I think that isn't possible right now, since <code>ControlFlow</code> is unstable, and I can't write a <code>ControlFlow</code> in chalk since that would require writing a <code>Try</code> implementation which is also unstable</p>



<a name="215168855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215168855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215168855">(Oct 31 2020 at 01:56)</a>:</h4>
<p>We discussed this in the meeting: we're okay to just duplicate the type for now</p>



<a name="215196972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215196972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215196972">(Oct 31 2020 at 15:40)</a>:</h4>
<p>(Opened <a href="https://github.com/rust-lang/chalk/issues/645">chalk#645</a>)</p>



<a name="215196977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215196977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215196977">(Oct 31 2020 at 15:40)</a>:</h4>
<p>That was quick</p>



<a name="215197083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197083">(Oct 31 2020 at 15:43)</a>:</h4>
<p>Hmm</p>



<a name="215197130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197130">(Oct 31 2020 at 15:44)</a>:</h4>
<p>I wonder if we could co-opt either Result or option here</p>



<a name="215197147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197147">(Oct 31 2020 at 15:44)</a>:</h4>
<p>(So either Result&lt;(), ()&gt; or Option&lt;()&gt;)</p>



<a name="215197179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197179">(Oct 31 2020 at 15:45)</a>:</h4>
<p>Then we can still use <code>?</code></p>



<a name="215197213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197213">(Oct 31 2020 at 15:46)</a>:</h4>
<p>And when ControlFlow is stable, just replace</p>



<a name="215197430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197430">(Oct 31 2020 at 15:52)</a>:</h4>
<p><code>Option</code> would <em>maybe</em> seem counterintuitive to me</p>



<a name="215197436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197436">(Oct 31 2020 at 15:52)</a>:</h4>
<p>Because you'd need to use <code>None</code> to break and <code>Some(())</code> to continue</p>



<a name="215197592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197592">(Oct 31 2020 at 15:56)</a>:</h4>
<p>Right, which is why I think maybe Result is better</p>



<a name="215197599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197599">(Oct 31 2020 at 15:57)</a>:</h4>
<p>(Though I prefer ControlFlow, but wish it was stable)</p>



<a name="215197697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215197697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215197697">(Oct 31 2020 at 15:59)</a>:</h4>
<p>Also, I think using <code>Result</code> means more refractoring to do when <code>ControlFlow</code> is stabilized (if you want to use it then)</p>



<a name="215204379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215204379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215204379">(Oct 31 2020 at 18:16)</a>:</h4>
<p>Hmm</p>



<a name="215204394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215204394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215204394">(Oct 31 2020 at 18:17)</a>:</h4>
<p>I guess I was mostly thinking about all the <code>try_break</code>s</p>



<a name="215204410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215204410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215204410">(Oct 31 2020 at 18:17)</a>:</h4>
<p>Maybe there is something we can do around type aliases</p>



<a name="215213725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215213725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215213725">(Oct 31 2020 at 21:54)</a>:</h4>
<p>Opened <a href="https://github.com/rust-lang/chalk/issues/646">chalk#646</a> which uses <code>type ControlFlow&lt;B, C = ()&gt; = Result&lt;C, B&gt;</code></p>



<a name="215213735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215213735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215213735">(Oct 31 2020 at 21:55)</a>:</h4>
<p>This solution doesn't have as many downsides as I first thought.</p>



<a name="215213994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215213994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215213994">(Oct 31 2020 at 22:01)</a>:</h4>
<p>Other idea, in the "define a clone" solution, maybe we could replace <code>try_break!</code> with:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">B</span><span class="p">,</span><span class="w"> </span><span class="n">C</span><span class="o">&gt;</span><span class="w"> </span><span class="n">ControlFlow</span><span class="o">&lt;</span><span class="n">B</span><span class="p">,</span><span class="w"> </span><span class="n">C</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">err</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nb">Result</span><span class="o">&lt;</span><span class="p">(),</span><span class="w"> </span><span class="p">()</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">match</span><span class="w"> </span><span class="bp">self</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">ControlFlow</span>::<span class="n">Continue</span><span class="p">(</span><span class="n">c</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="n">c</span><span class="p">),</span><span class="w"></span>
<span class="w">            </span><span class="n">ControlFlow</span>::<span class="n">Break</span><span class="p">(</span><span class="n">b</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="nb">Err</span><span class="p">(</span><span class="n">b</span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Which then allows to do:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">foo</span><span class="p">.</span><span class="n">visit_with</span><span class="p">(</span><span class="n">visitor</span><span class="p">).</span><span class="n">err</span><span class="p">()</span><span class="o">?</span><span class="w"></span>
</code></pre></div>
<p>Which gives the ergonomics of using <code>?</code> but still allows to write <code>ControlFlow::{CONTINUE,BREAK}</code>, and when <code>std::ops::ControlFlow</code> is stabilized I think we only have to remove those <code>.err()</code></p>



<a name="215218324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215218324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215218324">(Nov 01 2020 at 00:16)</a>:</h4>
<p>Ooh I think I like that idea</p>



<a name="215671233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215671233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215671233">(Nov 05 2020 at 04:54)</a>:</h4>
<p><span class="user-mention" data-user-id="255061">@LeSeulArtichaut</span> can you update your first PR for this?</p>



<a name="215674842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215674842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215674842">(Nov 05 2020 at 06:22)</a>:</h4>
<p>Sure</p>



<a name="215675838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215675838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215675838">(Nov 05 2020 at 06:47)</a>:</h4>
<p>Actually, will that work? Can <code>Try</code> convert from a <code>Result</code> back to a <code>ControlFlow</code>?</p>



<a name="215683514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215683514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215683514">(Nov 05 2020 at 08:46)</a>:</h4>
<p>Yeah, it doesn't:</p>
<div class="codehilite" data-code-language="Text only"><pre><span></span><code>the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
</code></pre></div>



<a name="215725059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215725059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215725059">(Nov 05 2020 at 15:14)</a>:</h4>
<p>Maybe if you impl <code>Into&lt;ControlFlow&gt;</code> for <code>Result</code></p>



<a name="215725082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215725082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215725082">(Nov 05 2020 at 15:14)</a>:</h4>
<p>Since <code>?</code> implicity calls <code>.into()</code></p>



<a name="215740713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215740713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Whitaker <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215740713">(Nov 05 2020 at 16:53)</a>:</h4>
<p>I think currently <code>?</code> calls <code>From::from</code>, though the original <code>try</code> RFC planned to use <code>into</code> (<a href="https://github.com/rust-lang/rust/issues/38751">#38751</a>)</p>



<a name="215741184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215741184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215741184">(Nov 05 2020 at 16:56)</a>:</h4>
<p>okay, so we could impl <code>From</code></p>



<a name="215743723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215743723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215743723">(Nov 05 2020 at 17:13)</a>:</h4>
<p>IIUC, you still need to implement <code>Try</code>:</p>
<blockquote>
<p>If an <code>Err(e)</code> result is returned, the value <code>e</code> will be "wrapped" in the return type of the enclosing scope (which must itself implement <code>Try</code>). Specifically, the value <code>X::from_error(From::from(e))</code> is returned, where <code>X</code> is the return type of the enclosing function.</p>
</blockquote>



<a name="215744098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215744098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215744098">(Nov 05 2020 at 17:15)</a>:</h4>
<p>bleh</p>



<a name="215744333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215744333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215744333">(Nov 05 2020 at 17:17)</a>:</h4>
<p>Okay, so I guess we choose between duplicating <code>ControlFlow</code> and adding a temporary <code>try_break!()</code> or we use <code>type ControlFlow = Result&lt;(), ()&gt;</code> and we have to use <code>ControlFlow::Ok(())</code> or <code>ControlFlow::Err(())</code></p>



<a name="215744533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215744533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215744533">(Nov 05 2020 at 17:19)</a>:</h4>
<p>If only you could do <code>type CONTINUE = Result::Ok(())</code></p>



<a name="215744614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215744614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215744614">(Nov 05 2020 at 17:19)</a>:</h4>
<p>But anyways, I think we can stick with the <code>try_break</code> version</p>



<a name="215744678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215744678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215744678">(Nov 05 2020 at 17:20)</a>:</h4>
<p><span class="user-mention" data-user-id="255061">@LeSeulArtichaut</span> think you can rebase? Then I'll take a quick look and r+</p>



<a name="215744716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215744716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215744716">(Nov 05 2020 at 17:20)</a>:</h4>
<p>Thought I had rebased already, probably forgot to push</p>



<a name="215744898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215744898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215744898">(Nov 05 2020 at 17:22)</a>:</h4>
<p>Oh, we <em>could</em> do <code>const CONTINUE: Result&lt;(), ()&gt; = Result::Ok(());</code></p>



<a name="215745071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215745071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215745071">(Nov 05 2020 at 17:22)</a>:</h4>
<p>and <code>const BREAK: Result&lt;(), ()&gt; = Result::Err(());</code></p>



<a name="215745346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215745346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215745346">(Nov 05 2020 at 17:24)</a>:</h4>
<p>I still think the <code>try_break</code> version is probably just better since there are less surprises or "tricks" around it</p>



<a name="215745414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215745414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215745414">(Nov 05 2020 at 17:25)</a>:</h4>
<p><span class="user-mention" data-user-id="255061">@LeSeulArtichaut</span> you did rebase, whoops</p>



<a name="215745593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215745593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215745593">(Nov 05 2020 at 17:26)</a>:</h4>
<p>Do you also want to do a followup PR for the break value when the MCP/implementation gets accepted?</p>



<a name="215745601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215745601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215745601">(Nov 05 2020 at 17:26)</a>:</h4>
<p>(for rustc)</p>



<a name="215746190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215746190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215746190">(Nov 05 2020 at 17:30)</a>:</h4>
<p>Gladly!</p>



<a name="215746366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215746366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215746366">(Nov 05 2020 at 17:31)</a>:</h4>
<p>I do think it's interesting that <code>ControlFlow</code> is essentially a non-trait version of <code>VisitResult</code></p>



<a name="215880049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215880049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215880049">(Nov 06 2020 at 17:45)</a>:</h4>
<blockquote>
<ul>
<li>easy first PR: <ul>
<li>make library, extract some leaf types</li>
</ul>
</li>
</ul>
</blockquote>
<p>I could maybe help here? Where should the types be extracted from, <code>rustc</code>, <code>chalk</code>? Both? Should there be the <code>Interner</code> trait from <code>chalk</code> already?</p>



<a name="215882980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215882980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215882980">(Nov 06 2020 at 18:10)</a>:</h4>
<p>From rustc, particularly rustc_middle</p>



<a name="215883063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215883063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215883063">(Nov 06 2020 at 18:11)</a>:</h4>
<p>The idea is to try to extract all the bits from rustc into a separate crate, iterate until it's like 1:1 equal to chalk-ir, then essentially just make them the same</p>



<a name="215883100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215883100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215883100">(Nov 06 2020 at 18:11)</a>:</h4>
<p>Got it, thanks!</p>



<a name="215883233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/215883233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#215883233">(Nov 06 2020 at 18:12)</a>:</h4>
<p>I imagine to start splitting things out, you'll probably need to start with an <code>Interner</code>-like trait, so you can be generic over things like <code>DefId</code></p>



<a name="217057680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/217057680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#217057680">(Nov 17 2020 at 20:26)</a>:</h4>
<p>I've been playing around a bit with this, and to the most difficult problem when trying to extract some struct or type from <code>rustc_middle</code> is methods (and <code>impl</code> in general). Often methods depend on types that are hard to extract because <code>rustc_middle</code> is such an entangled web of dependencies.</p>
<p>Even simple types like <code>Binder</code>:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Binder</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">T</span><span class="p">);</span><span class="w"></span>
</code></pre></div>
<p>Can't be extracted because of e.g. methods that depend on <code>TyCtxt</code> or because it takes types like <code>Ty</code> as a generic parameter, and you can't define <code>impl</code>s for <code>Binder</code> outside of the crate it's defined in.</p>



<a name="217059305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/217059305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#217059305">(Nov 17 2020 at 20:39)</a>:</h4>
<p>You can probably create extension traits for these cases</p>



<a name="217059401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/217059401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#217059401">(Nov 17 2020 at 20:40)</a>:</h4>
<p>or abstract out the needed functionality from <code>TyCtxt</code> into a trait which would also get split out (like the <code>Interner</code> trait)</p>



<a name="217059680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/217059680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#217059680">(Nov 17 2020 at 20:42)</a>:</h4>
<p>I feel like <em>most</em> things you'll need <code>TyCtxt</code> for will be interning, which we want to abstract out anyways</p>



<a name="219670249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219670249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219670249">(Dec 11 2020 at 22:27)</a>:</h4>
<p>What is the next step for <a href="https://github.com/rust-lang/rust/issues/79169">#79169</a>? Shall I open an MCP for the refractor?</p>



<a name="219670724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219670724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219670724">(Dec 11 2020 at 22:33)</a>:</h4>
<p>I think it's just waiting for a <span class="user-mention" data-user-id="116009">@nikomatsakis</span> review</p>



<a name="219670792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219670792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219670792">(Dec 11 2020 at 22:34)</a>:</h4>
<p>Maybe <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> has time and wants to work-steal</p>



<a name="219671125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219671125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219671125">(Dec 11 2020 at 22:38)</a>:</h4>
<p>Got it. I'm preparing another PR which will in particular create and refractor <code>rustc_type_ir::{FloatTy,IntTy,UintTy}</code></p>



<a name="219671239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219671239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219671239">(Dec 11 2020 at 22:40)</a>:</h4>
<p>Yeah, just feel free to stack them. (Or even, just do two, this one plus another that you add to)</p>



<a name="219671255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219671255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219671255">(Dec 11 2020 at 22:40)</a>:</h4>
<p>Not sure when Niko will have time to review</p>



<a name="219677431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219677431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219677431">(Dec 12 2020 at 00:10)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/79951">#79951</a> :)</p>



<a name="219703926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219703926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219703926">(Dec 12 2020 at 11:22)</a>:</h4>
<p>r+'d</p>



<a name="219705988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219705988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219705988">(Dec 12 2020 at 12:16)</a>:</h4>
<p>Thanks! <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="219906490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219906490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219906490">(Dec 14 2020 at 21:46)</a>:</h4>
<p>I don't really know how to handle <code>#[derive(TyEncodable, TyDecodable)]</code></p>



<a name="219906810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219906810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219906810">(Dec 14 2020 at 21:49)</a>:</h4>
<p>Yeah...I ran into those when trying to do <code>Binder&lt;'tcx, T&gt;</code> -&gt; <code>Binder&lt;T: HasInterner&gt;</code></p>



<a name="219906822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219906822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219906822">(Dec 14 2020 at 21:49)</a>:</h4>
<p>They generate things like:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">E</span>: <span class="nc">TyEncoder</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="n">Encodable</span><span class="o">&lt;</span><span class="n">E</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="cm">/*...*/</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Where <code>Encodable</code> is defined in <code>rustc_serialize</code> and <code>TyEncoder</code> is defined in <code>rustc_middle</code>, so I don't think I can implement that anywhere without hitting the orphan rules</p>



<a name="219906940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219906940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219906940">(Dec 14 2020 at 21:50)</a>:</h4>
<p>Sounds like the solution is to make <code>TyEncoder</code> be a part of the type library</p>



<a name="219906998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219906998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219906998">(Dec 14 2020 at 21:50)</a>:</h4>
<p>but then <em>everything</em> has to go in one swath</p>



<a name="219907003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907003">(Dec 14 2020 at 21:50)</a>:</h4>
<p>Can we? It depends on <code>TyCtxt</code> in its current form</p>



<a name="219907062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907062">(Dec 14 2020 at 21:51)</a>:</h4>
<p>What about <code>TyCtxt</code>? I imagine all the interning bits</p>



<a name="219907139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907139">(Dec 14 2020 at 21:52)</a>:</h4>
<p>It requires a <code>pub fn tcx(&amp;self) -&gt; TyCtxt&lt;'tcx&gt;</code> method</p>



<a name="219907141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907141">(Dec 14 2020 at 21:52)</a>:</h4>
<p>I wonder if it might be worth doing something like a <code>tcx</code> -&gt; <code>tcx.interner()</code> pass in place for now</p>



<a name="219907176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907176">(Dec 14 2020 at 21:52)</a>:</h4>
<p>Where <code>interner()</code> would return a type containing functions like <code>mk_...</code> and <code>intern_...</code></p>



<a name="219907202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907202">(Dec 14 2020 at 21:52)</a>:</h4>
<p>Now to know what that tcx it is used for I'd have to dive into the code</p>



<a name="219907225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907225">(Dec 14 2020 at 21:52)</a>:</h4>
<p>Which right now are <em>on</em> tcx itself</p>



<a name="219907297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907297">(Dec 14 2020 at 21:53)</a>:</h4>
<p>One part of the problem is that <em>a lot</em> gets added to tcx. Some through explict impls, some through macros, and some through queries.</p>



<a name="219907388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907388">(Dec 14 2020 at 21:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/219907225">said</a>:</p>
<blockquote>
<p>Which right now are <em>on</em> tcx itself</p>
</blockquote>
<p>But it's delegated to <code>CtxtInterners</code>, maybe this can help?</p>



<a name="219907437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907437">(Dec 14 2020 at 21:54)</a>:</h4>
<p>If <code>TyEncoder</code> only needs needs the interning bits, then that decreases the congnitive overhead quite a bit</p>



<a name="219907452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907452">(Dec 14 2020 at 21:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="255061">Léo Lanteri Thauvin</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/219907388">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/219907225">said</a>:</p>
<blockquote>
<p>Which right now are <em>on</em> tcx itself</p>
</blockquote>
<p>But it's delegated to <code>CtxtInterners</code>, maybe this can help?</p>
</blockquote>
<p>maybe</p>



<a name="219907502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219907502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219907502">(Dec 14 2020 at 21:55)</a>:</h4>
<p>I'll take a look</p>



<a name="219909196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219909196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219909196">(Dec 14 2020 at 22:09)</a>:</h4>
<p>Also there's <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/codec/trait.RefDecodable.html"><code>RefDecodable</code></a> which is presented as</p>
<blockquote>
<p>a separate trait from <code>Decodable</code> so that we can implement it for upstream types, such as <code>FxHashSet</code></p>
</blockquote>
<p>Though I'm not sure it can fit in this puzzle <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="219909819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219909819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219909819">(Dec 14 2020 at 22:13)</a>:</h4>
<p>Bleh. I think <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> did the refactor around this. Maybe they have thoughts. (Though aren't around currently)</p>



<a name="219909973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219909973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219909973">(Dec 14 2020 at 22:14)</a>:</h4>
<p>Also, at first glance, it looks like most of the uses of <code>TyCtxt</code> in <code>TyEncoder</code>/<code>TyDecoder</code> are indeed accesses to the <code>arena</code> and <code>mk_*</code> methods, but not all</p>



<a name="219910060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219910060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219910060">(Dec 14 2020 at 22:15)</a>:</h4>
<p>Examples:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">D</span>: <span class="nc">TyDecoder</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="n">Decodable</span><span class="o">&lt;</span><span class="n">D</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">ty</span>::<span class="n">SymbolName</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">decode</span><span class="p">(</span><span class="n">decoder</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">D</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nb">Result</span><span class="o">&lt;</span><span class="bp">Self</span><span class="p">,</span><span class="w"> </span><span class="n">D</span>::<span class="n">Error</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="nb">Ok</span><span class="p">(</span><span class="n">ty</span>::<span class="n">SymbolName</span>::<span class="n">new</span><span class="p">(</span><span class="n">decoder</span><span class="p">.</span><span class="n">tcx</span><span class="p">(),</span><span class="w"> </span><span class="o">&amp;</span><span class="n">decoder</span><span class="p">.</span><span class="n">read_str</span><span class="p">()</span><span class="o">?</span><span class="p">))</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">D</span>: <span class="nc">TyDecoder</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="n">RefDecodable</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">D</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">ty</span>::<span class="n">AdtDef</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">decode</span><span class="p">(</span><span class="n">decoder</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">D</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nb">Result</span><span class="o">&lt;&amp;'</span><span class="na">tcx</span><span class="w"> </span><span class="bp">Self</span><span class="p">,</span><span class="w"> </span><span class="n">D</span>::<span class="n">Error</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">def_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&lt;</span><span class="n">DefId</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">Decodable</span><span class="o">&lt;</span><span class="n">D</span><span class="o">&gt;&gt;</span>::<span class="n">decode</span><span class="p">(</span><span class="n">decoder</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="nb">Ok</span><span class="p">(</span><span class="n">decoder</span><span class="p">.</span><span class="n">tcx</span><span class="p">().</span><span class="n">adt_def</span><span class="p">(</span><span class="n">def_id</span><span class="p">))</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="219910109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219910109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219910109">(Dec 14 2020 at 22:15)</a>:</h4>
<p>And it looks like it isn't needed in <code>TyEncoder</code>?</p>



<a name="219910173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219910173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219910173">(Dec 14 2020 at 22:16)</a>:</h4>
<p>What happens if I remove it? <span aria-label="innocent" class="emoji emoji-1f607" role="img" title="innocent">:innocent:</span></p>



<a name="219911690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219911690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219911690">(Dec 14 2020 at 22:30)</a>:</h4>
<p>It does compile</p>



<a name="219914112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219914112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219914112">(Dec 14 2020 at 22:54)</a>:</h4>
<p>Opened <a href="https://github.com/rust-lang/rust/issues/80039">#80039</a> just in case</p>



<a name="219914992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/219914992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#219914992">(Dec 14 2020 at 23:03)</a>:</h4>
<p>Makes sense to me we don't need it in the encoder</p>



<a name="220047090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/220047090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#220047090">(Dec 15 2020 at 21:45)</a>:</h4>
<p><code>RefDecodable</code> is used by <code>derive(TyDecable)</code> to decode references.</p>



<a name="220047230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/220047230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#220047230">(Dec 15 2020 at 21:46)</a>:</h4>
<p>Moving things incrementally here is pretty hard. I'll try to spend some time thinking about it.</p>



<a name="232651963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232651963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232651963">(Mar 31 2021 at 19:36)</a>:</h4>
<p>Just wanted to put this here for tomorrow: <code>BoundRegionKind</code> is a good test case for a type we would want to move to <code>rustc_type_ir</code>; it has <code>Debug</code>, <code>HashStable</code>, <code>TyEncoder</code>/<code>TyDecoder</code> derives and uses a <code>DefId</code> (and <code>Symbol</code>, but that's basically like <code>DefId</code>)</p>



<a name="232652747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232652747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232652747">(Mar 31 2021 at 19:41)</a>:</h4>
<p>So, imagining I have this in <code>rustc_type_ir</code>:</p>
<div class="codehilite"><pre><span></span><code>pub trait Interner {
    type DefId;
    type Symbol;
}

#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Copy)]
pub enum BoundRegionKind&lt;I: Interner&gt; {
    BrAnon(u32),
    BrNamed(I::DefId, I::Symbol),
    BrEnv,
}
</code></pre></div>



<a name="232652831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232652831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232652831">(Mar 31 2021 at 19:42)</a>:</h4>
<p>And this in <code>rustc_middle</code>:</p>
<div class="codehilite"><pre><span></span><code>impl&lt;&#39;tcx&gt; rustc_type_ir::Interner for TyCtxt&lt;&#39;tcx&gt; {
    type DefId = DefId;
    type Symbol = Symbol;
}
</code></pre></div>



<a name="232652985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232652985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232652985">(Mar 31 2021 at 19:43)</a>:</h4>
<p>I thought I could do something like</p>
<div class="codehilite"><pre><span></span><code>impl&lt;CTX&gt; crate::ty::HashStable&lt;CTX&gt; for rustc_type_ir::BoundRegionKind&lt;TyCtxt&lt;&#39;tcx&gt;&gt; {
  ...
}
</code></pre></div>
<p>in <code>rustc_middle</code>, but I get <code>type parameter `CTX` must be used as the type parameter for some local type</code></p>



<a name="232653195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232653195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232653195">(Mar 31 2021 at 19:44)</a>:</h4>
<p>Similar with</p>
<div class="codehilite"><pre><span></span><code>impl&lt;&#39;tcx, CTX, E: TyEncoder&lt;&#39;tcx&gt;&gt; Encodable&lt;E&gt; for rustc_type_ir::BoundRegionKind&lt;TyCtxt&lt;&#39;tcx&gt;&gt; {
  ..
}
</code></pre></div>



<a name="232653393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232653393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232653393">(Mar 31 2021 at 19:45)</a>:</h4>
<p>Fun. I ran into a different but similar error when trying to do this:</p>
<div class="codehilite"><pre><span></span><code>impl&lt;&#39;tcx, T: ArenaAllocatable&lt;&#39;tcx&gt;&gt; AllocateIn&lt;TyCtxt&lt;&#39;tcx&gt;&gt; for T {
             //     ^ Error: type parameter `T` must be covered by another type when it appears before the first local type (`context::TyCtxt&lt;&#39;tcx&gt;`)
</code></pre></div>



<a name="232654150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654150">(Mar 31 2021 at 19:50)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> Does the <code>HashStable</code> impl need to be in rustc_middle? There's already some <code>HashStable</code> impls in rustc_type_ir</p>



<a name="232654185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654185">(Mar 31 2021 at 19:50)</a>:</h4>
<p>Not necessarily, no</p>



<a name="232654266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654266">(Mar 31 2021 at 19:50)</a>:</h4>
<p>But</p>



<a name="232654539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654539">(Mar 31 2021 at 19:52)</a>:</h4>
<p>Then you have to have <code>type DefId: HashStable&lt;CTX&gt;;</code> in <code>Interner</code></p>



<a name="232654586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654586">(Mar 31 2021 at 19:52)</a>:</h4>
<p>So you get a <code>CTX</code> param on <code>Interner</code></p>



<a name="232654793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654793">(Mar 31 2021 at 19:54)</a>:</h4>
<p>I'm curious if a <code>type DefId&lt;CTX&gt;: HashStable&lt;CTX&gt;;</code> would help but idk</p>



<a name="232654859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654859">(Mar 31 2021 at 19:54)</a>:</h4>
<p>you would still have to have a <code>CTX</code> param on <code>BoundRegionKind</code></p>



<a name="232654893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654893">(Mar 31 2021 at 19:54)</a>:</h4>
<p>Not the first time I wish I could do that for the interner <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="232654963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232654963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232654963">(Mar 31 2021 at 19:55)</a>:</h4>
<p>okay yeah I see your point</p>



<a name="232655106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655106">(Mar 31 2021 at 19:56)</a>:</h4>
<p>wasn't there a workaround for some other derive elsewhere?</p>



<a name="232655165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655165">(Mar 31 2021 at 19:56)</a>:</h4>
<p>Which derive</p>



<a name="232655204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655204">(Mar 31 2021 at 19:56)</a>:</h4>
<p>can't find it...</p>



<a name="232655262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655262">(Mar 31 2021 at 19:57)</a>:</h4>
<p>I'm a bit surprised that <code>impl&lt;CTX&gt; crate::ty::HashStable&lt;CTX&gt; for rustc_type_ir::BoundRegionKind&lt;TyCtxt&lt;'tcx&gt;&gt;</code> isn't legal</p>



<a name="232655323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655323">(Mar 31 2021 at 19:57)</a>:</h4>
<p>Since <code>TyCtxt&lt;'tcx&gt;</code> is local</p>



<a name="232655392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655392">(Mar 31 2021 at 19:58)</a>:</h4>
<p>Wait, the workaround was for <code>HashStable</code>: <code>HashStable_Generic</code></p>



<a name="232655482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655482">(Mar 31 2021 at 19:59)</a>:</h4>
<p>I think that just impls <code>HashStable&lt;CTX&gt;</code> instead of some <code>HashStable&lt;X&gt;</code></p>



<a name="232655610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655610">(Mar 31 2021 at 19:59)</a>:</h4>
<p>Oh there was also <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_serialize/trait.Encodable.html">Encodable</a> that has some workarounds for whether crates depend on rustc_middle or not</p>



<a name="232655616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655616">(Mar 31 2021 at 20:00)</a>:</h4>
<p>Specifically, that <code>X</code> is <code>rustc_middle::ich::StableHashingContext</code></p>



<a name="232655692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655692">(Mar 31 2021 at 20:00)</a>:</h4>
<p>That might have been <code>RefEncodable</code></p>



<a name="232655769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655769">(Mar 31 2021 at 20:00)</a>:</h4>
<p>(maybe)</p>



<a name="232655818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655818">(Mar 31 2021 at 20:00)</a>:</h4>
<p>err, I only see <code>RefDecodable</code></p>



<a name="232655856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655856">(Mar 31 2021 at 20:01)</a>:</h4>
<p><code>RefEncodable</code> <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/codec/trait.RefDecodable.html">mentions</a> it being a separate trait for upstream types</p>



<a name="232655891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232655891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232655891">(Mar 31 2021 at 20:01)</a>:</h4>
<p>The normal trait is <code>Decodable</code></p>



<a name="232656134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232656134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232656134">(Mar 31 2021 at 20:02)</a>:</h4>
<p>I only see that implemented for things like <code>&amp;'tcx List&lt;...&gt;</code></p>



<a name="232656339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232656339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232656339">(Mar 31 2021 at 20:04)</a>:</h4>
<p>The docs mention a lot more impls</p>



<a name="232656729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232656729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232656729">(Mar 31 2021 at 20:06)</a>:</h4>
<p>The only impl I see that isn't a slice or an interned type is on <code>FxHashSet&lt;LocalDefId&gt;</code></p>



<a name="232656818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232656818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232656818">(Mar 31 2021 at 20:07)</a>:</h4>
<p>And <code>Span</code>, but yeah that's mostly it</p>



<a name="232656874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232656874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232656874">(Mar 31 2021 at 20:07)</a>:</h4>
<p>(hidden inside a macro call <code>arena_types!(impl_arena_allocatable_decoders, [], 'tcx)</code></p>



<a name="232657172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232657172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232657172">(Mar 31 2021 at 20:09)</a>:</h4>
<p><code>Encodable</code> is implemented on <code>Span</code> <em>in</em> <code>rustc_span</code></p>



<a name="232657238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232657238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232657238">(Mar 31 2021 at 20:10)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_span/lib.rs.html#745-753">https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_span/lib.rs.html#745-753</a></p>



<a name="232657681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232657681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232657681">(Mar 31 2021 at 20:13)</a>:</h4>
<p>Like I said, I'm not exactly sure why <code>impl&lt;CTX&gt; crate::ty::HashStable&lt;CTX&gt; for rustc_type_ir::BoundRegionKind&lt;TyCtxt&lt;'tcx&gt;&gt;</code> shouldn't be okay. I guess it is because you might want have</p>
<div class="codehilite"><pre><span></span><code>// another crate
struct Foo {}
impl crate::ty::HashStable&lt;Foo&gt; for rustc_type_ir::BoundRegionKind&lt;TyCtxt&lt;&#39;tcx&gt;&gt;
</code></pre></div>



<a name="232657765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232657765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232657765">(Mar 31 2021 at 20:14)</a>:</h4>
<p>But that feels wrong to me: since now <code>rustc_type_ir::BoundRegionKind&lt;TyCtxt&lt;'tcx&gt;&gt;</code> is all foreign</p>



<a name="232657997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232657997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232657997">(Mar 31 2021 at 20:15)</a>:</h4>
<p>I guess, you could write</p>
<div class="codehilite"><pre><span></span><code>impl&lt;T, U&gt; crate::ty::HashStable&lt;T&gt; for rustc_type_ir::BoundRegionKind&lt;U&gt;
</code></pre></div>



<a name="232658097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232658097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232658097">(Mar 31 2021 at 20:16)</a>:</h4>
<p>in <code>rustc_type_ir</code></p>



<a name="232658245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232658245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232658245">(Mar 31 2021 at 20:17)</a>:</h4>
<p>Sounds somewhat like a <code>fundamental</code> related problem</p>



<a name="232658484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232658484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232658484">(Mar 31 2021 at 20:19)</a>:</h4>
<p>yeah, that's precisely it :/</p>



<a name="232659486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232659486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232659486">(Mar 31 2021 at 20:26)</a>:</h4>
<p>I bet if we tried to impl <code>Encodable</code> for some specific <code>TyEncoder</code>, this would be fine</p>



<a name="232659573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232659573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232659573">(Mar 31 2021 at 20:27)</a>:</h4>
<p>maybe. Idk</p>



<a name="232660264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232660264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232660264">(Mar 31 2021 at 20:31)</a>:</h4>
<p>solution: make all types in <code>rustc_type_ir</code> <code>fundamental</code></p>



<a name="232752833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232752833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232752833">(Apr 01 2021 at 13:06)</a>:</h4>
<p>I didn't really follow this :)</p>



<a name="232752835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232752835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232752835">(Apr 01 2021 at 13:06)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="232752840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232752840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232752840">(Apr 01 2021 at 13:06)</a>:</h4>
<p>should I read it?</p>



<a name="232752849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232752849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232752849">(Apr 01 2021 at 13:06)</a>:</h4>
<p>or is there a tl;dr</p>



<a name="232752866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232752866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232752866">(Apr 01 2021 at 13:07)</a>:</h4>
<p>what I had hoped to do was to continue sketching the thing we are shooting for</p>



<a name="232752874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232752874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232752874">(Apr 01 2021 at 13:07)</a>:</h4>
<p>Probably just reread from yesterday</p>



<a name="232752912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232752912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232752912">(Apr 01 2021 at 13:07)</a>:</h4>
<p>There's not that much but it's important</p>



<a name="232753092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753092">(Apr 01 2021 at 13:08)</a>:</h4>
<p>I've also got a few questions regarding the <code>AllocateIn</code> trait idea, but that might be too specific</p>



<a name="232753250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753250">(Apr 01 2021 at 13:09)</a>:</h4>
<p>Yes, so, there are the kinds of coherence issues I was afraid of</p>



<a name="232753260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753260">(Apr 01 2021 at 13:09)</a>:</h4>
<p>Pain in the neck :/</p>



<a name="232753284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753284">(Apr 01 2021 at 13:10)</a>:</h4>
<p>Yeah</p>



<a name="232753298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753298">(Apr 01 2021 at 13:10)</a>:</h4>
<p>I don't want to make everything fundamental :)</p>



<a name="232753351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753351">(Apr 01 2021 at 13:10)</a>:</h4>
<p>lol</p>



<a name="232753361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753361">(Apr 01 2021 at 13:10)</a>:</h4>
<p>where's the hackmd we were looking at?</p>



<a name="232753393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753393">(Apr 01 2021 at 13:10)</a>:</h4>
<p><a href="https://hackmd.io/K8cPSWn3So2GlPPvPuktAQ">https://hackmd.io/K8cPSWn3So2GlPPvPuktAQ</a></p>



<a name="232753546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753546">(Apr 01 2021 at 13:11)</a>:</h4>
<p>ok</p>



<a name="232753553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753553">(Apr 01 2021 at 13:11)</a>:</h4>
<p>so let's add some of this to that?</p>



<a name="232753758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753758">(Apr 01 2021 at 13:13)</a>:</h4>
<p>first question</p>



<a name="232753771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753771">(Apr 01 2021 at 13:13)</a>:</h4>
<p>why does <code>HashStable</code> live in <code>rustc_middle</code>?</p>



<a name="232753785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753785">(Apr 01 2021 at 13:13)</a>:</h4>
<p>is that the right place for it?</p>



<a name="232753800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753800">(Apr 01 2021 at 13:13)</a>:</h4>
<p>The impl?</p>



<a name="232753804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753804">(Apr 01 2021 at 13:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232753553">said</a>:</p>
<blockquote>
<p>so let's add some of this to that?</p>
</blockquote>
<p>done</p>



<a name="232753816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753816">(Apr 01 2021 at 13:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232753771">said</a>:</p>
<blockquote>
<p>why does <code>HashStable</code> live in <code>rustc_middle</code>?</p>
</blockquote>
<p>the trait</p>



<a name="232753826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753826">(Apr 01 2021 at 13:13)</a>:</h4>
<p><code>HashStable</code> itself is in <code>rustc_data_structures</code></p>



<a name="232753841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753841">(Apr 01 2021 at 13:13)</a>:</h4>
<p>ah, ok, the impl was misleading</p>



<a name="232753913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753913">(Apr 01 2021 at 13:14)</a>:</h4>
<p>Sorry :) It's reexported through <code>rustc_middle</code></p>



<a name="232753944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753944">(Apr 01 2021 at 13:14)</a>:</h4>
<p>ok, next question: why does the impl live in <code>rustc_middle</code> :)</p>



<a name="232753963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753963">(Apr 01 2021 at 13:14)</a>:</h4>
<p>because hash-stable isn't really something most people care about, I guess?</p>



<a name="232753995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232753995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232753995">(Apr 01 2021 at 13:14)</a>:</h4>
<p>I kind of hate re-exports :)</p>



<a name="232754009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754009">(Apr 01 2021 at 13:15)</a>:</h4>
<p>Well, I think we want it to live in <code>rustc_middle</code></p>



<a name="232754024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754024">(Apr 01 2021 at 13:15)</a>:</h4>
<p>say why :)</p>



<a name="232754059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754059">(Apr 01 2021 at 13:15)</a>:</h4>
<p>Well, do we need it in <code>rustc_type_ir</code>?</p>



<a name="232754065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754065">(Apr 01 2021 at 13:15)</a>:</h4>
<p>(I can believe it, just want to be sure I understand)</p>



<a name="232754089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754089">(Apr 01 2021 at 13:15)</a>:</h4>
<p>I don't know :)</p>



<a name="232754109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754109">(Apr 01 2021 at 13:15)</a>:</h4>
<p>I'm trying to come up with a good rule of what should be where</p>



<a name="232754120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754120">(Apr 01 2021 at 13:15)</a>:</h4>
<p>We really only care about <code>HashStable</code> for <code>StableHashingContext</code></p>



<a name="232754126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754126">(Apr 01 2021 at 13:15)</a>:</h4>
<p>so I wanted to drive that through examples</p>



<a name="232754182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754182">(Apr 01 2021 at 13:16)</a>:</h4>
<p>if coherence wasn't a thing, I don't think there would be a reason for it to be in <code>rustc_type_ir</code></p>



<a name="232754252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754252">(Apr 01 2021 at 13:16)</a>:</h4>
<p>because only rustc wants it</p>



<a name="232754258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754258">(Apr 01 2021 at 13:16)</a>:</h4>
<p>and not (e.g.) rust-analyzer</p>



<a name="232754262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754262">(Apr 01 2021 at 13:16)</a>:</h4>
<p>?</p>



<a name="232754273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754273">(Apr 01 2021 at 13:17)</a>:</h4>
<p>correct</p>



<a name="232754318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754318">(Apr 01 2021 at 13:17)</a>:</h4>
<p>it's for incremental compilation in rustc, so RA shouldn't need it</p>



<a name="232754436"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754436" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754436">(Apr 01 2021 at 13:18)</a>:</h4>
<p>otoh</p>



<a name="232754457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754457">(Apr 01 2021 at 13:18)</a>:</h4>
<p>it's not <em>harmful</em> exactly</p>



<a name="232754467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754467">(Apr 01 2021 at 13:18)</a>:</h4>
<p>I think the <code>HashStable</code> impl is easy: We can easily change it from <code>HashStable&lt;CTX&gt;</code> to <code>HashStable&lt;StableHashingContext&gt;</code> and it will work fine</p>



<a name="232754487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754487">(Apr 01 2021 at 13:18)</a>:</h4>
<p>is there a reason it <em>can't</em> live in <code>rustc_type_ir</code>?</p>



<a name="232754495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754495">(Apr 01 2021 at 13:18)</a>:</h4>
<p>(for example, behind a feature)</p>



<a name="232754538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754538">(Apr 01 2021 at 13:19)</a>:</h4>
<p>But it's also something we might want to depend on anyways (<code>rustc_data_structures</code>)</p>



<a name="232754602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754602">(Apr 01 2021 at 13:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232754467">said</a>:</p>
<blockquote>
<p>I think the <code>HashStable</code> impl is easy: We can easily change it from <code>HashStable&lt;CTX&gt;</code> to <code>HashStable&lt;StableHashingContext&gt;</code> and it will work fine</p>
</blockquote>
<p>the only time i've had trouble with this</p>



<a name="232754631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754631">(Apr 01 2021 at 13:19)</a>:</h4>
<p>well, do we have existing impls that are hard-coded to <code>StableHashingContext</code>?</p>



<a name="232754681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754681">(Apr 01 2021 at 13:20)</a>:</h4>
<p>I've had troubles with that pattern sometimes trying to compose derive impls with hand-written ones</p>



<a name="232754722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754722">(Apr 01 2021 at 13:20)</a>:</h4>
<p>in particular, if you change <code>BoundRegionKind</code>, you'll have to change a bunch of other impls -- anything that contains a <code>BoundRegionKind</code></p>



<a name="232754762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754762">(Apr 01 2021 at 13:20)</a>:</h4>
<p>I think all the <code>HashStable</code> derives use <code>StableHashingContext</code></p>



<a name="232754790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754790">(Apr 01 2021 at 13:20)</a>:</h4>
<p>But <code>HashStable_Generic</code> uses <code>CTX</code></p>



<a name="232754819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754819">(Apr 01 2021 at 13:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232754790">said</a>:</p>
<blockquote>
<p>But <code>HashStable_Generic</code> uses <code>CTX</code></p>
</blockquote>
<p>what is that?</p>



<a name="232754844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754844">(Apr 01 2021 at 13:21)</a>:</h4>
<p>just a different derive</p>



<a name="232754853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754853">(Apr 01 2021 at 13:21)</a>:</h4>
<p>(Side note: I kind of want to extend the language so that coherence applies at the workspace level)</p>



<a name="232754862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754862">(Apr 01 2021 at 13:21)</a>:</h4>
<p>actually I <em>really</em> want that</p>



<a name="232754888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754888">(Apr 01 2021 at 13:21)</a>:</h4>
<p>That would be nice</p>



<a name="232754890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754890">(Apr 01 2021 at 13:21)</a>:</h4>
<p>though it has some issues</p>



<a name="232754905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754905">(Apr 01 2021 at 13:21)</a>:</h4>
<p>but it would obviously be nice and would solve all these sorts of annoying problems</p>



<a name="232754911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754911">(Apr 01 2021 at 13:21)</a>:</h4>
<p>Would that require <code>pub(crate)</code> visibility, or can that be done automatically?</p>



<a name="232754914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754914">(Apr 01 2021 at 13:21)</a>:</h4>
<p>anyway let's not worry about <em>that</em> for now :)</p>



<a name="232754989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232754989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232754989">(Apr 01 2021 at 13:22)</a>:</h4>
<p>I kind of wish adding a blanket impl was backwards-incompatible</p>



<a name="232755038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755038">(Apr 01 2021 at 13:22)</a>:</h4>
<p>back to the task at hand :)</p>



<a name="232755045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755045">(Apr 01 2021 at 13:22)</a>:</h4>
<p>yes</p>



<a name="232755049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755049">(Apr 01 2021 at 13:22)</a>:</h4>
<p>ok, so <code>HashSTable</code> is maybe not a problem</p>



<a name="232755061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755061">(Apr 01 2021 at 13:22)</a>:</h4>
<p>no</p>



<a name="232755062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755062">(Apr 01 2021 at 13:22)</a>:</h4>
<p>are there other traits that are?</p>



<a name="232755066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755066">(Apr 01 2021 at 13:22)</a>:</h4>
<p>yes</p>



<a name="232755075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755075">(Apr 01 2021 at 13:22)</a>:</h4>
<p>there seem to be two solutions for <code>HashStable</code></p>



<a name="232755079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755079">(Apr 01 2021 at 13:22)</a>:</h4>
<p><code>Encodable</code>/<code>Decodable</code></p>



<a name="232755084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755084">(Apr 01 2021 at 13:23)</a>:</h4>
<ol>
<li>change the trait parameter</li>
</ol>



<a name="232755105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755105">(Apr 01 2021 at 13:23)</a>:</h4>
<ol start="2">
<li>move the impl into rustc_type_ir, behind a feature gate if desired</li>
</ol>



<a name="232755135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755135">(Apr 01 2021 at 13:23)</a>:</h4>
<p>Yep</p>



<a name="232755172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755172">(Apr 01 2021 at 13:23)</a>:</h4>
<p>I'm adding Q/As to the bottom of <a href="https://hackmd.io/K8cPSWn3So2GlPPvPuktAQ">the hackmd</a></p>



<a name="232755178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755178">(Apr 01 2021 at 13:23)</a>:</h4>
<p>to record facts :)</p>



<a name="232755299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755299">(Apr 01 2021 at 13:24)</a>:</h4>
<p>I'd go so far as to say that we <strong>will</strong> depend on <code>rustc_data_structures</code></p>



<a name="232755320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755320">(Apr 01 2021 at 13:24)</a>:</h4>
<p>after all, we're going to need the "newtype'd index" stuff</p>



<a name="232755345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755345">(Apr 01 2021 at 13:24)</a>:</h4>
<p>Yep</p>



<a name="232755370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755370">(Apr 01 2021 at 13:24)</a>:</h4>
<p><em>But</em></p>



<a name="232755382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755382">(Apr 01 2021 at 13:25)</a>:</h4>
<p><code>Encodable</code>/<code>Decodable</code></p>



<a name="232755398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755398">(Apr 01 2021 at 13:25)</a>:</h4>
<p>yes, we'll get to that :)</p>



<a name="232755405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755405">(Apr 01 2021 at 13:25)</a>:</h4>
<p>let me just note this one thing down</p>



<a name="232755421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755421">(Apr 01 2021 at 13:25)</a>:</h4>
<p>well, start</p>



<a name="232755474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755474">(Apr 01 2021 at 13:25)</a>:</h4>
<p>ok, talk to me about Encodable</p>



<a name="232755571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755571">(Apr 01 2021 at 13:26)</a>:</h4>
<div class="message_inline_image"><a href="https://media.giphy.com/media/KFUx0Rtz7p0HTzbJ7x/source.gif"><img src="https://media.giphy.com/media/KFUx0Rtz7p0HTzbJ7x/source.gif"></a></div>



<a name="232755582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755582">(Apr 01 2021 at 13:26)</a>:</h4>
<p>that's roughly how I feel when I hear that trait name</p>



<a name="232755637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755637">(Apr 01 2021 at 13:26)</a>:</h4>
<p>ok maybe more like this</p>



<a name="232755641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755641">(Apr 01 2021 at 13:26)</a>:</h4>
<div class="message_inline_image"><a href="https://media.giphy.com/media/1jl6QxY2EJpexXl0EJ/giphy.gif"><img src="https://media.giphy.com/media/1jl6QxY2EJpexXl0EJ/giphy.gif"></a></div>



<a name="232755648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755648">(Apr 01 2021 at 13:26)</a>:</h4>
<p>carry on</p>



<a name="232755659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755659">(Apr 01 2021 at 13:27)</a>:</h4>
<p>Didn't we already figure out <code>Encodable</code> with the current PR?</p>



<a name="232755700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755700">(Apr 01 2021 at 13:27)</a>:</h4>
<p>It already does everything through the <code>Interner</code> trait instead of using <code>TyCtxt</code> directly</p>



<a name="232755725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755725">(Apr 01 2021 at 13:27)</a>:</h4>
<p>mmm, did we?</p>



<a name="232755757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755757">(Apr 01 2021 at 13:27)</a>:</h4>
<p>I don't think <code>TyCtxt</code> is the problem</p>



<a name="232755777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755777">(Apr 01 2021 at 13:28)</a>:</h4>
<p>It's the fact of <em>where does the impl live</em></p>



<a name="232755923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755923">(Apr 01 2021 at 13:28)</a>:</h4>
<p>If we put the impls in <code>rustc_type_ir</code>, then yes, we can't depend on <code>TyCtxt</code></p>



<a name="232755968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755968">(Apr 01 2021 at 13:29)</a>:</h4>
<p>But, if we don't want to depend on <code>rustc_serialize</code>, we probably need to put those in <code>rustc_middle</code></p>



<a name="232755983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232755983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232755983">(Apr 01 2021 at 13:29)</a>:</h4>
<p>The problem is these impls:</p>



<a name="232756040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756040">(Apr 01 2021 at 13:29)</a>:</h4>
<div class="codehilite"><pre><span></span><code>impl&lt;&#39;tcx, CTX, E: TyEncoder&lt;&#39;tcx&gt;&gt; Encodable&lt;E&gt; for rustc_type_ir::BoundRegionKind&lt;TyCtxt&lt;&#39;tcx&gt;&gt; {
  ..
}
</code></pre></div>
<p>and similiar for <code>Decodable</code></p>



<a name="232756045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756045">(Apr 01 2021 at 13:29)</a>:</h4>
<p>isn't legal</p>



<a name="232756302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756302">(Apr 01 2021 at 13:31)</a>:</h4>
<p>let's put that in the doc</p>



<a name="232756338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756338">(Apr 01 2021 at 13:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232755968">said</a>:</p>
<blockquote>
<p>But, if we don't want to depend on <code>rustc_serialize</code>, we probably need to put those in <code>rustc_middle</code></p>
</blockquote>
<p>and why don't we want to?</p>



<a name="232756354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756354">(Apr 01 2021 at 13:31)</a>:</h4>
<p>this seems like another case of</p>



<a name="232756360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756360">(Apr 01 2021 at 13:31)</a>:</h4>
<p>That uses the <code>TyDecodable</code> instead though, which is generated using rustc_macros</p>



<a name="232756369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756369">(Apr 01 2021 at 13:31)</a>:</h4>
<p>"we could"</p>



<a name="232756556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756556">(Apr 01 2021 at 13:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232756360">said</a>:</p>
<blockquote>
<p>That uses the <code>TyDecodable</code> instead though, which is generated using rustc_macros</p>
</blockquote>
<p>No, it just uses <code>TyDecoder</code></p>



<a name="232756568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756568">(Apr 01 2021 at 13:33)</a>:</h4>
<p>(Which is in <code>rustc_middle</code>)</p>



<a name="232756635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756635">(Apr 01 2021 at 13:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232756369">said</a>:</p>
<blockquote>
<p>"we could"</p>
</blockquote>
<p>Indeed, I guess we <em>could</em></p>



<a name="232756725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756725">(Apr 01 2021 at 13:33)</a>:</h4>
<p>(oh right, in <a href="https://github.com/detrumi/rust/blob/a4daa63a90f46e3c6e36efe5e0743eab09f6f12b/compiler/rustc_macros/src/serialize.rs#L10-L10">here</a>)</p>



<a name="232756740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756740">(Apr 01 2021 at 13:34)</a>:</h4>
<p>But I wonder if we <em>did</em>, if <code>Interner</code> would have to be generic over some <code>Decoder</code>/<code>Encoder</code></p>



<a name="232756791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756791">(Apr 01 2021 at 13:34)</a>:</h4>
<p>say more?</p>



<a name="232756861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756861">(Apr 01 2021 at 13:34)</a>:</h4>
<p>I guess I should review the trait + impls</p>



<a name="232756880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756880">(Apr 01 2021 at 13:34)</a>:</h4>
<p>I don't quite understand its structure</p>



<a name="232756886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756886">(Apr 01 2021 at 13:34)</a>:</h4>
<p>Well, so lets imagine</p>



<a name="232756905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756905">(Apr 01 2021 at 13:34)</a>:</h4>
<div class="codehilite"><pre><span></span><code>trait Interner&lt;E, D&gt; {
  type Span: Encodable&lt;E&gt; + Decodable&lt;D&gt;
}
</code></pre></div>



<a name="232756923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756923">(Apr 01 2021 at 13:34)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">E</span>: <span class="nc">TyEncoder</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="w"></span>
</code></pre></div>



<a name="232756943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756943">(Apr 01 2021 at 13:35)</a>:</h4>
<p>that bound is problematic</p>



<a name="232756952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232756952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232756952">(Apr 01 2021 at 13:35)</a>:</h4>
<p>perhaps this is your point</p>



<a name="232757015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757015">(Apr 01 2021 at 13:35)</a>:</h4>
<p>that... seems like a non-starter</p>



<a name="232757031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757031">(Apr 01 2021 at 13:35)</a>:</h4>
<p>I don't understand why it would be needed</p>



<a name="232757047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757047">(Apr 01 2021 at 13:35)</a>:</h4>
<p>but I'd like to know a bit more about what the body of the impls look like first</p>



<a name="232757051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757051">(Apr 01 2021 at 13:36)</a>:</h4>
<p>Well, I don't think we're going to care if we have <code>TyEncoder</code> or not</p>



<a name="232757110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757110">(Apr 01 2021 at 13:36)</a>:</h4>
<p>can you give me an example impl?</p>



<a name="232757157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757157">(Apr 01 2021 at 13:36)</a>:</h4>
<p>Well, let's start by looking at the <code>BoundRegionKind</code> struct</p>



<a name="232757188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757188">(Apr 01 2021 at 13:36)</a>:</h4>
<p>That has <code>I::DefId</code></p>



<a name="232757270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757270">(Apr 01 2021 at 13:37)</a>:</h4>
<p>So, if we want  to derive <code>Encodable</code> <em>for any <code>E: Encoder</code></em>, then <code>I::DefId: E</code></p>



<a name="232757299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757299">(Apr 01 2021 at 13:37)</a>:</h4>
<p>ok</p>



<a name="232757312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757312">(Apr 01 2021 at 13:37)</a>:</h4>
<p>so we would want something like</p>



<a name="232757350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757350">(Apr 01 2021 at 13:37)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">E</span><span class="p">,</span><span class="w"> </span><span class="n">I</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Encodable</span><span class="o">&lt;</span><span class="n">E</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">BoundRegionKind</span><span class="o">&lt;</span><span class="n">I</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">I</span>: <span class="nc">Interner</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">I</span>::<span class="n">DefId</span>: <span class="nc">Encodable</span><span class="o">&lt;</span><span class="n">E</span><span class="o">&gt;</span><span class="w"></span>
</code></pre></div>



<a name="232757402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757402">(Apr 01 2021 at 13:38)</a>:</h4>
<p>or, alternatively</p>



<a name="232757433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757433">(Apr 01 2021 at 13:38)</a>:</h4>
<p><span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span>‍♀️ oh yeah, that's the simplest way to do that</p>



<a name="232757447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757447">(Apr 01 2021 at 13:38)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">trait</span><span class="w"> </span><span class="n">EncodableInterner</span><span class="o">&lt;</span><span class="n">E</span><span class="o">&gt;</span>: <span class="nc">Interner</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="bp">Self</span>::<span class="n">DefId</span>: <span class="nc">Encodable</span><span class="o">&lt;</span><span class="n">E</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>actually, without implied bounds, I don't think that will work</p>



<a name="232757567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757567">(Apr 01 2021 at 13:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232756740">said</a>:</p>
<blockquote>
<p>But I wonder if we <em>did</em>, if <code>Interner</code> would have to be generic over some <code>Decoder</code>/<code>Encoder</code></p>
</blockquote>
<p>just forget about this statement, it's not true :)</p>



<a name="232757707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757707">(Apr 01 2021 at 13:40)</a>:</h4>
<p>ok, so, we <em>could</em> put it in <code>rustc-type-ir</code></p>



<a name="232757717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757717">(Apr 01 2021 at 13:40)</a>:</h4>
<p>We did some experimenting with Encodable bounds on the Interner types before, but changing Encodable to take an Interner definitely sounds better</p>



<a name="232757722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757722">(Apr 01 2021 at 13:40)</a>:</h4>
<p>but we'd need impls like that</p>



<a name="232757773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757773">(Apr 01 2021 at 13:40)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232757717">said</a>:</p>
<blockquote>
<p>We did some experimenting with Encodable bounds on the Interner types before, but changing Encodable to take an Interner definitely sounds better</p>
</blockquote>
<p>clarify?</p>



<a name="232757800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757800">(Apr 01 2021 at 13:41)</a>:</h4>
<p>the main question I have is whether this <code>TyEncoder&lt;'tcx&gt;</code> bound is important</p>



<a name="232757840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757840">(Apr 01 2021 at 13:41)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/codec/trait.TyEncoder.html">TyEncoder</a></p>



<a name="232757910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757910">(Apr 01 2021 at 13:41)</a>:</h4>
<p>Right, so I think any types that would explicitly need <code>TyEncoder</code> will be an associated type on <code>Interner</code></p>



<a name="232757912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757912">(Apr 01 2021 at 13:41)</a>:</h4>
<p>it looks like that could be rewritten to use Interner <code>I</code></p>



<a name="232757919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757919">(Apr 01 2021 at 13:41)</a>:</h4>
<p>A previous iteration of the Interner design had things like <code>&lt;TyInterner&lt;'tcx&gt; as Interner&lt;D&gt;&gt;</code>, but that was before we removed the interner lifetime, so I just don't think that'll work</p>



<a name="232757927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232757927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232757927">(Apr 01 2021 at 13:42)</a>:</h4>
<p>i.e., it could be <code>TyEncoder&lt;I&gt;</code></p>



<a name="232758014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758014">(Apr 01 2021 at 13:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232757910">said</a>:</p>
<blockquote>
<p>Right, so I think any types that would explicitly need <code>TyEncoder</code> will be an associated type on <code>Interner</code></p>
</blockquote>
<p>I don't think that's required</p>



<a name="232758076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758076">(Apr 01 2021 at 13:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232757350">said</a>:</p>
<blockquote>
<p><div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">E</span><span class="p">,</span><span class="w"> </span><span class="n">I</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Encodable</span><span class="o">&lt;</span><span class="n">E</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">BoundRegionKind</span><span class="o">&lt;</span><span class="n">I</span><span class="o">&gt;</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">E</span>: <span class="nc">TyEncoder</span><span class="o">&lt;</span><span class="n">I</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">I</span>: <span class="nc">Interner</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">I</span>::<span class="n">DefId</span>: <span class="nc">Encodable</span><span class="o">&lt;</span><span class="n">E</span><span class="o">&gt;</span><span class="w"></span>
</code></pre></div><br>
</p>
</blockquote>



<a name="232758165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758165">(Apr 01 2021 at 13:43)</a>:</h4>
<p>Well, <code>TyEncoder</code> is in <code>rustc_middle</code></p>



<a name="232758196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758196">(Apr 01 2021 at 13:43)</a>:</h4>
<p>why?</p>



<a name="232758285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758285">(Apr 01 2021 at 13:44)</a>:</h4>
<div class="codehilite"><pre><span></span><code>    fn type_shorthands(&amp;mut self) -&gt; &amp;mut FxHashMap&lt;Ty&lt;&#39;tcx&gt;, usize&gt;;
    fn predicate_shorthands(&amp;mut self) -&gt; &amp;mut FxHashMap&lt;ty::PredicateKind&lt;&#39;tcx&gt;, usize&gt;;
</code></pre></div>



<a name="232758296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758296">(Apr 01 2021 at 13:44)</a>:</h4>
<p>because of those, I think</p>



<a name="232758326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758326">(Apr 01 2021 at 13:44)</a>:</h4>
<p>So, maybe it could be moved into <code>rustc_type_ir</code> under this scheme</p>



<a name="232758863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758863">(Apr 01 2021 at 13:48)</a>:</h4>
<p>so</p>



<a name="232758892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758892">(Apr 01 2021 at 13:48)</a>:</h4>
<p>I was imagining it would be changed to <code>Ty&lt;I&gt;</code> etc</p>



<a name="232758911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758911">(Apr 01 2021 at 13:48)</a>:</h4>
<p>in the fullness of time</p>



<a name="232758925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232758925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232758925">(Apr 01 2021 at 13:48)</a>:</h4>
<p>that said, I agree we probably don't <em>want</em> that</p>



<a name="232759068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759068">(Apr 01 2021 at 13:49)</a>:</h4>
<p>right</p>



<a name="232759087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759087">(Apr 01 2021 at 13:49)</a>:</h4>
<p>This is just what's in <code>rustc_middle</code> right now</p>



<a name="232759642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759642">(Apr 01 2021 at 13:53)</a>:</h4>
<p>let me rephrase</p>



<a name="232759649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759649">(Apr 01 2021 at 13:53)</a>:</h4>
<p>let me rephrase</p>



<a name="232759662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759662">(Apr 01 2021 at 13:53)</a>:</h4>
<p>I think we <em>do</em> want it to be generic over <code>I</code></p>



<a name="232759689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759689">(Apr 01 2021 at 13:53)</a>:</h4>
<p>but we may still want the trait to live in <code>rustc_middle</code> :)</p>



<a name="232759694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759694">(Apr 01 2021 at 13:53)</a>:</h4>
<p>that said</p>



<a name="232759702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759702">(Apr 01 2021 at 13:53)</a>:</h4>
<p>I don't quite see how we can do that easily</p>



<a name="232759762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759762">(Apr 01 2021 at 13:54)</a>:</h4>
<p>I think I would be fine with moving stuff like that into <code>rustc_type_ir</code>, at least for now</p>



<a name="232759785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759785">(Apr 01 2021 at 13:54)</a>:</h4>
<p>under a feature gate if needed</p>



<a name="232759795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759795">(Apr 01 2021 at 13:54)</a>:</h4>
<p>what's unclear to me is</p>



<a name="232759825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759825">(Apr 01 2021 at 13:54)</a>:</h4>
<p>(a) if there are cases where that is not an option</p>



<a name="232759878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759878">(Apr 01 2021 at 13:55)</a>:</h4>
<p>I would guess it's always an option, but it may take some gymnastics</p>



<a name="232759900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232759900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232759900">(Apr 01 2021 at 13:55)</a>:</h4>
<p>and (b) how to transition bit by bit (harder)</p>



<a name="232760003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760003">(Apr 01 2021 at 13:56)</a>:</h4>
<p>Yeah, there's going to be a big swathe of things that have to be moved together</p>



<a name="232760049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760049">(Apr 01 2021 at 13:56)</a>:</h4>
<p>there <em>is</em> also the option of (perhaps under a feature gate...) extending <code>Interner</code> to have some of those <code>TyEncoder</code> methods</p>



<a name="232760061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760061">(Apr 01 2021 at 13:56)</a>:</h4>
<p>Since you can't have <code>TyFoldable</code> with <code>Ty</code></p>



<a name="232760065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760065">(Apr 01 2021 at 13:56)</a>:</h4>
<p>e.g.</p>



<a name="232760395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760395">(Apr 01 2021 at 13:58)</a>:</h4>
<p>But I think the "solution" for now is to move all the impls into <code>rustc_type_ir</code> and then move to a feature-gate in the future</p>



<a name="232760423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760423">(Apr 01 2021 at 13:58)</a>:</h4>
<p>that sounds right</p>



<a name="232760432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760432">(Apr 01 2021 at 13:58)</a>:</h4>
<p>I am good with that</p>



<a name="232760442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760442">(Apr 01 2021 at 13:58)</a>:</h4>
<p>I do think there's some missing features of rust</p>



<a name="232760454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760454">(Apr 01 2021 at 13:58)</a>:</h4>
<p>I dont' want to block on those :)</p>



<a name="232760456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760456">(Apr 01 2021 at 13:58)</a>:</h4>
<p>Unless someone comes up with a clever way to get around the coherence issues</p>



<a name="232760502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760502">(Apr 01 2021 at 13:58)</a>:</h4>
<p>there may be hacks we can do but</p>



<a name="232760525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760525">(Apr 01 2021 at 13:58)</a>:</h4>
<p>feature-gated code seems simpler</p>



<a name="232760569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760569">(Apr 01 2021 at 13:59)</a>:</h4>
<p>then e.g. artificially rearranging type parameters or introducing newtypes</p>



<a name="232760629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232760629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232760629">(Apr 01 2021 at 13:59)</a>:</h4>
<p>Looking at the crates involved, do we want to reference rustc_arena from rustc_type_ir? That'd simplify all the alloc functions that are currently on <code>Interner</code> if we could include a <code>ArenaAllocatable</code> bound</p>



<a name="232761219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761219">(Apr 01 2021 at 14:02)</a>:</h4>
<p>maybe</p>



<a name="232761261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761261">(Apr 01 2021 at 14:02)</a>:</h4>
<p>I don't know why I'm drawing the line there lol</p>



<a name="232761323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761323">(Apr 01 2021 at 14:03)</a>:</h4>
<p>well</p>



<a name="232761367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761367">(Apr 01 2021 at 14:03)</a>:</h4>
<p>I definitely don't want to hardcode anything that involves lifetime parameters etc</p>



<a name="232761559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761559">(Apr 01 2021 at 14:04)</a>:</h4>
<p>ok, well, I have to run, but this was a good start :)</p>



<a name="232761565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761565">(Apr 01 2021 at 14:04)</a>:</h4>
<p>Oh right, yeah the lifetime param is a problem</p>



<a name="232761590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761590">(Apr 01 2021 at 14:04)</a>:</h4>
<p>I guess I would say</p>



<a name="232761620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761620">(Apr 01 2021 at 14:05)</a>:</h4>
<p>it seems like being the arena is <em>the reason</em> that <code>Interner</code> exists</p>



<a name="232761636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232761636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232761636">(Apr 01 2021 at 14:05)</a>:</h4>
<p>so maybe that's part of my hesitation :)</p>



<a name="232882443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232882443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232882443">(Apr 02 2021 at 10:08)</a>:</h4>
<p>I'm a bit afraid to ask this, but will the type library require nightly/RUSTC_BOOTSTRAP, and will Chalk depend on it? :/</p>



<a name="232884566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232884566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232884566">(Apr 02 2021 at 10:33)</a>:</h4>
<p>I know that during the initial design meeting for the proposal, the question was deferred</p>



<a name="232884706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232884706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232884706">(Apr 02 2021 at 10:35)</a>:</h4>
<p>See <a href="https://rust-lang.github.io/compiler-team/minutes/design-meeting/2020-03-12-shared-library-for-types#deferred-questions">the meeting notes</a></p>



<a name="232894677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232894677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232894677">(Apr 02 2021 at 12:46)</a>:</h4>
<p>I think we almost definitely want to say no to that <span class="user-mention" data-user-id="129457">@Florian Diebold</span></p>



<a name="232894880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232894880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232894880">(Apr 02 2021 at 12:48)</a>:</h4>
<p>No to requiring nightly or no to building on stable?</p>



<a name="232895539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232895539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232895539">(Apr 02 2021 at 12:57)</a>:</h4>
<p>We almost definitely want Chalk to build on stable</p>



<a name="232895558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232895558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232895558">(Apr 02 2021 at 12:57)</a>:</h4>
<p>And by extension, the type library</p>



<a name="232899840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232899840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232899840">(Apr 02 2021 at 13:42)</a>:</h4>
<p>I consider it a requirement that the type library has a version that builds on stable</p>



<a name="232899864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232899864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232899864">(Apr 02 2021 at 13:42)</a>:</h4>
<p>I'd be ok with having some features that require nightly though</p>



<a name="232900541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232900541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232900541">(Apr 02 2021 at 13:48)</a>:</h4>
<p>Looking at what's currently in rustc_type_ir, <code>newtype_index!</code> requires <code>#![feature(const_panic)]</code> atm, though I think they're not hard required since they're only used for asserts in const functions</p>



<a name="232900698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232900698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232900698">(Apr 02 2021 at 13:49)</a>:</h4>
<p>We'll have to see what features are currently used in code that gets moved from rustc_middle, and change things to eliminate the nightly requirement</p>



<a name="232902600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232902600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232902600">(Apr 02 2021 at 14:07)</a>:</h4>
<p>You can replace a const panic with an index out of bounds. Horrible UX, but same behaviour</p>



<a name="232903242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232903242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232903242">(Apr 02 2021 at 14:13)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> Can you give an example? What would that look like for <code>assert!(idx &lt;= u32::MAX as usize)</code>?</p>



<a name="232903419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/232903419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#232903419">(Apr 02 2021 at 14:15)</a>:</h4>
<p><code>[()][(idx &gt; u32::MAX as usize) as usize]</code></p>



<a name="233170340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/233170340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#233170340">(Apr 05 2021 at 13:16)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/144729-wg-traits/topic/type.20library.20discussion/near/232900541">said</a>:</p>
<blockquote>
<p>Looking at what's currently in rustc_type_ir, <code>newtype_index!</code> requires <code>#![feature(const_panic)]</code> atm, though I think they're not hard required since they're only used for asserts in const functions</p>
</blockquote>
<p>I think we shouldn't worry too much about features right now</p>



<a name="233170345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/233170345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#233170345">(Apr 05 2021 at 13:16)</a>:</h4>
<p>we can use them to start</p>



<a name="233170351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/233170351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#233170351">(Apr 05 2021 at 13:16)</a>:</h4>
<p>and then separately try to remove them</p>



<a name="233171803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/233171803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#233171803">(Apr 05 2021 at 13:30)</a>:</h4>
<p>Ah, well, I already removed the ones that were there, as the current rustc_type_ir code barely uses nightly features</p>



<a name="233171882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/type%20library%20discussion/near/233171882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/type.20library.20discussion.html#233171882">(Apr 05 2021 at 13:31)</a>:</h4>
<p>I think <code>rustc_data_structures</code> uses various features, in particular</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>